<%@ page import="common.*,java.sql.*,db.*,java.util.*,java.net.*,java.io.*;" contentType="text/html; charset=utf-8" %>
<%
String pay_code 	= CommonUtil.nvl(request.getParameter("pay_code"),"");
String link_id 		= CommonUtil.nvl(request.getParameter("link_id"),"");
String member_test_code 		= CommonUtil.nvl(request.getParameter("member_test_code"),"");
String test_state 		= CommonUtil.nvl(request.getParameter("test_state"),"");
String ent_alias 		= CommonUtil.nvl(request.getParameter("ent_alias"),"");
String rating_state 		= CommonUtil.nvl(request.getParameter("rating_state"),"0");

System.out.println("연동 정보  pay_code => "+pay_code+" link_id=>"+link_id+" member_test_code=>"+member_test_code+" test_state=>"+test_state+" ent_alias=>"+ent_alias+" rating_state=>"+rating_state);

String site_url = request.getServerName().replace("http://","");

String result= null ;
URL url = null;

if(ent_alias.equals("daekyo")){
	url = new URL("http://admin.dkeol.com/solution/testresult.jsp?pay_code="+pay_code+"&link_id="+link_id+"&member_test_code="+member_test_code+"&test_state="+test_state+"&rating_state="+rating_state);
}else if(ent_alias.equals("pagoda")){
	url = new URL("http://www.testclinic.com/opic/opicStudyLog.jsp?pay_code="+pay_code+"&link_id="+link_id+"&member_test_code="+member_test_code+"&test_state="+test_state+"&rating_state="+rating_state);
		
}else if(ent_alias.equals("ton")){
	url = new URL("http://www.tonenglish.co.kr/test_solution/getExamData.php?pay_code="+pay_code+"&link_id="+link_id+"&member_test_code="+member_test_code+"&test_state="+test_state+"&rating_state="+rating_state);
		
}else if(ent_alias.equals("hackers")){
        url = new URL("http://www.champstudy.com/tonenglish/exam_update.php?pay_code="+pay_code+"&link_id="+link_id+"&member_test_code="+member_test_code+"&test_state="+test_state+"&rating_state="+rating_state);
}else if(ent_alias.equals("tonedu")){
    url = new URL("http://www.tonedu.net/protocol/saveIBTInfo.jsp?pay_code="+pay_code+"&link_id="+link_id+"&member_test_code="+member_test_code+"&test_state="+test_state+"&rating_state="+rating_state);
}




URLConnection urlConn = null;
BufferedReader br = null;

if(url != null){
	urlConn = url.openConnection();
	urlConn.setConnectTimeout(20000);
	urlConn.connect();
	
	br = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
	StringBuffer sb = new StringBuffer();
	String line = "";
	
	while ((line = br.readLine()) != null) {
	 sb.append(line);
	}
	
	result = sb.toString();
	
	if (br != null) br.close(); br = null;
	
	System.out.println("연동 결과"+ result);
}
%>

